<template lang="">
  <div>
    <el-row>
      <el-col :span="3">
         
      </el-col>
      <el-col :span="4" style="text-align: center">
        
      </el-col>

      <el-col :span="8">
        <el-button
          @click="company_name_click(0)"
          icon="el-icon-search"
          class="add_btn"
        >
          搜索</el-button
        >
        <el-button
          icon="el-icon-refresh"
          @click="company_name_clicks"
          class="add_btn"
        >
          重置</el-button
        >
        <el-button @click="dayin" class="add_btn"> 打印</el-button>
      </el-col>
    </el-row>

    <el-table
      :data="dataList"
      stripe
      style="width: 100%"
      @selection-change="handleSelectionChange"
      border
    >
      <el-table-column type="selection"> </el-table-column>
      <el-table-column prop="id" label="ID" width="60"> </el-table-column>
      <el-table-column prop="warehouse_entry_time" label="入库日期" width="100">
      </el-table-column>
      <el-table-column label="客户名称" width="80">
        <template slot-scope="scope">
          {{
            scope.row.order.customer
              ? scope.row.order.customer.customer_name
              : ""
          }}
        </template>
      </el-table-column>
      <el-table-column label="订单号" width="70">
        <template slot-scope="scope">
          {{ scope.row.order.order_number }}
        </template>
      </el-table-column>
      <el-table-column label="流水号" width="70">
        <template slot-scope="scope">
          {{ scope.row.order.serial_number }}
        </template>
      </el-table-column>

      <el-table-column label="产品名称" width="80">
        <template slot-scope="scope">
          {{ scope.row.order.product_name.product_name }}
        </template>
      </el-table-column>
      <el-table-column label="产品型号" width="80">
        <template slot-scope="scope">
          {{ scope.row.order.model_number_name.model_number }}
        </template>
      </el-table-column>
      <el-table-column label="方向" width="60">
        <template slot-scope="scope">
          {{ scope.row.direction }}
        </template>
      </el-table-column>
      <el-table-column label="规格" width="70">
        <template slot-scope="scope">
          {{
            scope.row.order.specification
              ? scope.row.order.specification.specification
              : ""
          }}
        </template>
      </el-table-column>
      <el-table-column label="颜色" width="70">
        <template slot-scope="scope">
          {{ scope.row.order.color ? scope.row.order.color.color : "" }}
        </template>
      </el-table-column>
      <el-table-column label="备注" width="120">
        <template slot-scope="scope">
          {{ scope.row.order.remark }}
        </template>
      </el-table-column>
      <el-table-column prop="logistics_status" label="发货状态" width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.logistics_status == 1" style="color: #dd8211"
            >待发货</span
          >
          <span v-if="scope.row.logistics_status == 2" style="color: #f1420d"
            >未发货</span
          >
          <span v-if="scope.row.logistics_status == 4" style="color: #b47425"
            >部分待发货</span
          >
          <span v-if="scope.row.logistics_status == 5" style="color: #b47425"
            >部分未发货</span
          >
          <span v-if="scope.row.logistics_status == 3" style="color: #0ca747"
            >已发货</span
          >
        </template>
      </el-table-column>
      <el-table-column label="发货时间" width="120">
        <template slot-scope="scope">
          {{ scope.row.delivery_time }}
        </template>
      </el-table-column>
      <el-table-column label="物流信息" width="120">
        <template slot-scope="scope">
          {{ scope.row.logistics_info }}
        </template>
      </el-table-column>
      <el-table-column label="件数" width="70">
        <template slot-scope="scope">
          <div @dblclick="dbclick_input(scope.row.id)">
            <el-input
              v-model="scope.row.num"
              @blur="push_num_jianshu(scope.row.id, scope.row.num)"
              :disabled="disableds['disableds_' + scope.row.id]"
            ></el-input>
          </div>
        </template>
      </el-table-column>

      <el-table-column label="已发件数" width="90">
        <template slot-scope="scope">
          {{ scope.row.sent_num }}
        </template>
      </el-table-column>
      <el-table-column label="待发件数" width="80">
        <template slot-scope="scope">
          {{ scope.row.to_be_sent_num }}
        </template>
      </el-table-column>

      <el-table-column label="仓库" width="120">
        <template slot-scope="scope">
          {{ scope.row.warehouse.warehouse_name }}
        </template>
      </el-table-column>

      <el-table-column label="操作" width="90" fixed="right">
        <template slot-scope="scope">
          <el-dropdown trigger="click">
            <el-button type="primary" size="small">
              操作<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                <el-popconfirm
                  v-if="
                    scope.row.is_deduct_money == 2 ||
                    scope.row.is_deduct_money == null
                  "
                  confirm-button-text="好的"
                  cancel-button-text="不用了"
                  icon-color="red"
                  title="确定将此产品进行扣款吗？"
                  @confirm="koukuan(scope.row.id, 1)"
                >
                  <el-button slot="reference" type="text"> 扣款</el-button>
                </el-popconfirm>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-popconfirm
                  v-if="scope.row.is_deduct_money == 1"
                  confirm-button-text="好的"
                  cancel-button-text="不用了"
                  icon-color="red"
                  title="确定将此扣款进行取消吗？"
                  @confirm="koukuan(scope.row.id, 2)"
                >
                  <el-button slot="reference" type="text"> 取消扣款</el-button>
                </el-popconfirm>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  @click="diaohuo(scope.row)"
                  type="text"
                  :disabled="scope.row.logistics_status != 2"
                  >调货</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="padding-left: 8px"
                  @click="diaohuojilu(scope.row)"
                  :disabled="scope.row.stock_allocation_log.length == 0"
                  type="text"
                  >调货记录</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  type="text"
                  style="padding-left: 8px; padding-right: 8px"
                  :disabled="
                    scope.row.logistics_status == 1 ||
                    scope.row.logistics_status == 3
                  "
                  @click="push_daifahuos(scope.row)"
                  >设置为待发货</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-popconfirm
                  confirm-button-text="好的"
                  cancel-button-text="不用了"
                  icon-color="red"
                  title="确定将此产品转到备货库吗？"
                  @confirm="beihuo(scope.row)"
                >
                  <el-button
                    slot="reference"
                    :disabled="scope.row.logistics_status == 3"
                    type="text"
                  >
                    转到备货库</el-button
                  >
                </el-popconfirm>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  type="text"
                  @click="
                    chengpin_shanchu(scope.row.id, scope.row.order.order_number)
                  "
                  >删除</el-button
                >
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <!-- <div
            style="
              display: grid;
              grid-template-rows: 1fr 1fr;
              grid-template-columns: 1fr 1fr 1fr;
              grid-gap: 10px;
              justify-items: center;
              align-items: center;
            "
          >
          </div> -->
        </template>
      </el-table-column>
    </el-table>

    <div class="pagination">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        background
        @prev-click="prev"
        @next-click="next"
        :current-page.sync="pagination.page"
        :page-size="pagination.per_page"
        layout="total, prev, pager, next"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import { getCheckLogList } from "@/api/product/index";
export default {
  data() {
    return {
        ser:{

        },
        pagination: {
        per_page: 10,
        page: 1,
      
      },
      total: 0,
    };
  },
  mounted(){
    this.get_CheckLogList()
  },
  methods: {
    get_CheckLogList(){
        getCheckLogList().then(res=>{

        })
    },
    company_name_click(type) {
      if (type == 0) {
        this.pagination.per_page = 10;
        this.pagination.page = 1;
      }
      getCheckLogList({ ...this.ser, ...this.pagination }).then((res) => {
        if (res.code == 200) {
          this.productList = res.data.data;
          this.total = res.data.total;
        }
      });
    },
    company_name_clicks() {
      this.ser.company_name = "";
      getCheckLogList(this.pagination).then((res) => {
        if (res.code == 200) {
          this.productList = res.data.data;
          this.total = res.data.total;
        }
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.page = val;
      this.getlist();
    },
    prev() {
      this.pagination.page = this.pagination.page - 1;
      this.getlist();
    },
    next() {
      this.pagination.page = this.pagination.page + 1;
      this.getlist();
    },

  },
};
</script>
<style lang=""></style>
